body {
    background-color: wheat;
}

.wrap {
    margin-top: 150px;
    perspective: 1000px;
}

.cube {
    margin: auto;
    position: relative;
    height: 200px;
    width: 200px;
    transform-style: preserve-3d;
    animation: rotate 20s infinite linear;
    animation-direction: alternate;
}

.cube div {
    position: absolute;
    padding: 10px;
    box-sizing: border-box;
    height: 100%;
    width: 100%;
    opacity: 0.9;
    background-color: #000;
    border: solid 1px #000000;
    color: #fff;
    font: 10px arial;
    transition: transform 0.2s ease-in;
}

.front {
    background: url(../img/banhua1.png);
    transform: translateZ(100px);
}

.back {
    background: url(../img/banhua2.png);
}

.left {
    background: url(../img/banhua4.png);
    transform: rotateY(270deg) translateX(-100px);
    transform-origin: center left;
}

.right {
    background: url(../img/banhua3.png);
    transform: rotateY(-270deg) translateX(100px);
    transform-origin: top right;
}


.top {
    background: url(../img/banhua5.png);
    transform: rotateX(-270deg) translateY(-100px);
    transform-origin: top center;
}

.bottom {
    background: url(../img/banhua6.png);
    transform: rotateX(270deg) translateY(100px);
    transform-origin: bottom center;
}

/* inner cube */
img {
    position: absolute;
    top: 50px;
    left: 50px;
    width: 100px;
    height: 100px;
    display: block;
    background: url(../img/banhua6.png);
    transition: all 2s;
}

img.i_front {
    transform: translateZ(50px);
}

img.i_back {
    transform: translateZ(50px) rotateY(180deg);
}

img.i_left {
    transform: rotateY(-90deg) translateX(-50px);
    transform-origin: left center;
}

img.i_right {
    transform: rotateY(-90deg) translateX(50px);
    transform-origin: top right;
}

img.i_top {
    transform: rotateX(90deg) translateY(-50px);
    transform-origin: top center;
}

img.i_bottom {
    transform: rotateX(-90deg) translateY(50px);
    transform-origin: bottom center;
}


@keyframes rotate {
    from {
        transform: rotateX(0deg) rotateY(0deg);
    }
    to {
        transform: rotateX(360deg) rotateY(360deg);
    }
}


.wrap:hover .front {
    transform: translateZ(400px);
}

.wrap:hover .back {
    transform: translateZ(-400px) rotateY(180deg);
}

.wrap:hover .right {
    transform: rotateY(-270deg) translateZ(200px) translateX(100px);
}

.wrap:hover .left {
    transform: rotateY(270deg) translateZ(200px) translateX(-100px);
}

.wrap:hover .top {
    transform: rotateX(-270deg) translateZ(200px) translateY(-100px);
}

.wrap:hover .bottom {
    transform: rotateX(270deg) translateZ(200px) translateY(100px);
}


@keyframes bganim {
    from {
        background-position: 0px;
    }
    to {
        background-position: 100px;
    }
}